package com.wmx;

import com.wmx.service.impl.IAsyncService;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import java.util.Map;
@Component
public class WmxBeanFactory implements ApplicationContextAware {
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        Map<String, IAsyncService> beansOfType = applicationContext.getBeansOfType(IAsyncService.class);
        for (Map.Entry<String, IAsyncService> stringIAsyncServiceEntry : beansOfType.entrySet()) {
            System.out.println("加载的bean"+stringIAsyncServiceEntry.getKey());
        }

    }
}
